package com.ofood.springcloudalibaba.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class FoodController {
    @Value("${food.nacos.provider.url}")
    private String foodUrl;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/port")
    public String getPort(){
        return restTemplate.getForObject(foodUrl+"/port",String.class);
    }

}
